package jt.classic.system.tablequery;

import java.util.List;
import java.util.Map;

import org.limp.basework.Column;
import org.limp.mine.Render;

public class JQueryDataTableRender implements Render {
	private List alienList;

	private List notshowList;

	private boolean showChk;

	private Column primaryKeyColumn;

	public JQueryDataTableRender(List alienList, List notshowList,
			boolean showChk, Column primaryKeyColumn) {
		this.alienList = alienList;
		this.notshowList = notshowList;
		this.showChk = showChk;
		this.primaryKeyColumn = primaryKeyColumn;
	}

	public void render(Map arg0, int idxInAll, int idxInPage) {
		// TODO Auto-generated method stub
		if (arg0 != null) {
			if (this.alienList != null && this.alienList.size() > 0) {
				for (int i = 0; i < this.alienList.size(); i++) {
					Map item = (Map) this.alienList.get(i);
					arg0.put(item.get("fieldName"), "");
				}
			}

			if (this.showChk) {
				arg0.put("datatable_chk", (primaryKeyColumn != null ? arg0
						.get(this.primaryKeyColumn.getName()) : "-1"));
			}
		}
	}
}
